<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>getScript()获取数据</title>
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <script src="js/jquery-1.12.4.js"></script>
</head>
<body>
    <div id="showTestMsg">使用getScript()获取数据</div>
    <!--<div id="showTestMsg">bill yooh 50</div>-->
    <input type="button" id="btn1" value="获取JS数据">
    <script>
//    $(function(){
//        $("#btn1").click(function(){
//            $.get("test.txt",function(data){
//                $("#showTestMsg").html(data);
//            },"text");
//        });
//    });
// alert("张三")
    $(function(){
        $("#btn1").click(function(){
            $.getScript("test.js",function(){
                $("#showTestMsg").html(data.firstname+" "+data.lastname+" "+data.old);
                console.log(data);
            },"text");
        });
    });
    
    
    </script>
</body>
</html>